package aden.Generic.Param;

import java.util.Vector;
import aden.Generic.Param.GenParamException;

public class GenParamIter
{
	public GenParamIter()
	{
		mStep = Step_Undefined;
	}
	
	public boolean Begin(GenParamNode inNode)
	{
		mStep = Step_Undefined;
		if (inNode == null)
		{
			return false;
		}
		mNodes.add(inNode);
		mCurrent = inNode;
		mStep = Step_BEGINNODE;
		return true;
	}
	
	public boolean Next()
	{
		return true;
	}
	
	public int GetNextIntContent() throws GenParamException
	{
		if (!IsNotDone())
		{
			throw new GenParamException();
//			return 0;
		}
		GenParamData theContent = GetContent();
		if (theContent.GetType() != GenParamData.Type_INT)
		{
			throw new GenParamException();
//			return 0;
		}
		return theContent.GetIntValue().GetValue();
	}
	
	public boolean IsNotDone()
	{
		return mStep != Step_Undefined;
	}
	
	public int          GetStep()    {return mStep;}
	public GenParamData GetContent() {return mCurrent;}
	
	private Vector<GenParamNode> mNodes;
	private GenParamData mCurrent;
	
	public static final int Step_BEGINNODE = 0;
	public static final int Step_PRIM      = 1;
	public static final int Step_ENDNODE   = 2;
	public static final int Step_Undefined = 3;
	
	private	int mStep;
}

